package com.beyondsoft.giinii.brie.jni;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;

public class FacesortDemo extends Activity {
	protected String mInputPath;
	protected String mOutputPath;
	protected Dialog onCreateDialog(int id) 
    {
        // This example shows how to add a custom layout to an AlertDialog
		LayoutInflater factory = LayoutInflater.from(this);

		final View textEntryView = factory.inflate(R.layout.main, null);
		final EditText inputText = (EditText) textEntryView
				.findViewById(R.id.editText_input);
		final EditText outputText = (EditText) textEntryView
				.findViewById(R.id.editText_output);
        
    	AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setIcon(R.drawable.alert_dialog_icon);
        builder.setTitle(R.string.dialog_config);
        builder.setView(textEntryView);
        builder.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() 
        {
            public void onClick(DialogInterface dialog, int whichButton) 
            {
                // User clicked OK so do some stuff 
            	mInputPath = inputText.getText().toString();
            	mOutputPath = outputText.getText().toString();
            	
    			Intent iten = new Intent(FacesortDemo.this, MainDialog.class);
    			iten.putExtra("InputPath", mInputPath);
    			iten.putExtra("OutputPath", mOutputPath);    			
                startActivity(iten);
            }
        });
/**/        
        builder.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() 
        {
            public void onClick(DialogInterface dialog, int whichButton) 
            {
                //User clicked cancel so do some stuff
            }
        });
        
        return builder.create();
    }
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.main);
        showDialog(0);
    }
}